package com.dg11185.nearshop.net.response;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class GetDayMerListResponse {

    public String statusStr = "";
    public String responseStr = "";

    public NetStatus status = null;

    public String total = null;

    public List<VipDaysShop> dayMerList = null;

    public GetDayMerListResponse() {
    	dayMerList = new ArrayList<VipDaysShop>();
    }

    public void parseJson(String response) {
        try {
            responseStr = response;
            JSONObject jsonObject = new JSONObject(response);
            status = NetStatus.getStatus(jsonObject.optString("status"));
            statusStr = jsonObject.getString("status");
            total = jsonObject.optString("total");

            if (!jsonObject.isNull("dayMerList")) {
                JSONArray array = jsonObject.optJSONArray("dayMerList");
                for (int a = 0; a < array.length(); a++) {
                	JSONObject j = array.getJSONObject(a);
                    VipDaysShop mer = new VipDaysShop();
                    mer.merchantId = j.getString("merchantId");
                    mer.merchantName = j.getString("merchantName");
                    mer.week = j.getString("week");
                    mer.preferentialType = j.getString("preferentialType");
                    mer.preferential = j.getString("preferential");
                    mer.maxPhotoUrl = j.getString("maxPhotoUrl");
                    mer.minPhotoUrl = j.getString("minPhotoUrl");
                    mer.midPhotoUrl = j.getString("midPhotoUrl");
                    mer.areaNum = j.getString("areaNum");
                    mer.industryId = j.getString("industryId");
                    mer.endTime = j.getString("endTime");
                    dayMerList.add(mer);
                }
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    
    public class VipDaysShop
    {
    	public String merchantId;
    	public String merchantName;
    	public String week;
    	public String preferentialType;
    	public String preferential;
    	public String maxPhotoUrl;
    	public String minPhotoUrl;
    	public String midPhotoUrl;
    	public String areaNum;
    	public String industryId;
    	public String endTime;
    }
}
